<template>
  <div>
    <mt-header title="设备系统">
        <mt-button icon="back" slot="left" @click="getExitFromAndroid()"></mt-button>
    </mt-header>
    <div>
      <div class="icon" v-for="module in modulelist" @click="gotoBillPage(module.path)">
        <img :src="module.img_src" style="width: 60px;height: 60px;"/>
        <span>{{module.name}}</span>
      </div>
    </div>
  </div>
</template>

<script>

  export default {
    name: "MainPage",
    created() {
      this.getDataFromAndroid();
    },
    data() {
      return {
        jsonString: 'title',
        usertype:'',
        modulelist: [{
          id: 0,
          name: '接单',
          img_src: require('../assets/module1.png'),
          path: 'BillPage'
        }, {
          id: 1,
          name: '进度',
          img_src: require('../assets/module2.png'),
          path: 'SchedulePage'
        }]
      }
    },
    methods: {
      gotoBillPage(path) {
        this.$router.push({name: path})
      },
      showMsg() {
        this.$toast(this.jsonString);
        // this.$indicator.open()
      },
      getDataFromAndroid() {
        var that=this;
        that.usertype= test.getUserType();
        that.$toast(that.usertype)
      },
      getExitFromAndroid(){
        test.LeaveWebPage();
      }
    }
  }

</script>

<style scoped>
  .icon {
    padding-top: 10px;
    padding-bottom: 10px;
    display: inline;
    float: left;
    width: 25%;
    text-align: center;
  }

  .icon span {
    display: block;
  }

</style>
